package com.kcbsdk;

import android.util.Log;

/**
 * Created by apple on 16/8/27.
 *
 * cd /Users/apple/Desktop/云点安卓/MultiDDNS/kcbsdk/src/main/java/
 * javah com.kcbsdk.cjmkcs
 * cd /Users/apple/Desktop/Studio/FollowKBa/kcbsdk/src/main/java/
 * javah com.kcbsdk.cjmkcs
 */
public class cjmkcs {
    static {
        System.loadLibrary("kcbsvr");
    }
    public static String gsFilePath;

    public interface MessageListener    {
        public void messageReceived(int type, int g4Local_1, String gsLocal_1, String gsLocal_2);
    }
    private static MessageListener[] mMessageListener = null;
    private static byte gSystemClose;

    public static boolean SYSTEM_STARTUP(int appVersion, String appName, String filePath, String deviceModel, int startPort, String fixIPAddr)  {
        if (mMessageListener == null){
            mMessageListener = new MessageListener[8];
        }
        gsFilePath = filePath;
        gSystemClose = 0;
        return systemStartup(appVersion, appName, filePath, deviceModel, startPort, fixIPAddr);
    }

    public static void SET_MSG_CALLBACK(int classType, MessageListener gpCallback) {
        int classNumber = (classType >> 24) & 0x07;
        if (mMessageListener[classNumber] == null){
            mMessageListener[classNumber] = gpCallback;
        }
    }
    public static void SYSTEM_CLOSE() {       				// 退出应用
        //   gSystemClose = 1;
        systemClose();
    }
    public static void fromJniCallBack(int type, int g4Local_1, String gsLocal_1, String gsLocal_2) {
        int classNumber = (type >> 24) & 0x07;
        if (mMessageListener[classNumber] != null){
            mMessageListener[classNumber].messageReceived(type, g4Local_1, gsLocal_1, gsLocal_2);
        }
    }
    public static native boolean systemStartup(int appVersion, String appName, String filePath, String deviceModel, int startPort, String fixIPAddr);
    public static native void systemSetDebugFlag(int debugFlag, int loadDelay);
    public static native void systemClose();
    public static native int systemPollingEvent(int taskType, int retType);
    public static native int systemClearEvent(int taskType, int event, int mode);
    public static native int systemSetMethodType(int type) ;
    public static native String systemGetMethodMessage(int type);
    public static native int systemGetWpapperValue(int type);
    public static native String systemGetWpapperString(int type);
    public static native String systemGetMemoryString(String key);
    public static native void systemSetMemoryString(String key, String gsLocal_1);
    public static native String systemGetAreaData(int type, String province, String city, String regions);
    public static native void systemSetNetworkWifi(int noWifi, String wifiSSID,String wifiMAC,int ipAddress,int netMask,int gateWay);
    public static native String systemGetSmartDate(int dateTime);
    public static native void systemGetDatabaseList(int type, int mainID, int subID, int extrID, String mixText, int retType);
    public static native int systemDatabaseListIndex(int type, int number, int index);
    public static native int systemLoadDbsListFile(int dbsType, int mainID, int subID, int extrID, int otherID);
    public static native void systemLocalInfoList(int type, int userID, int fileID, int fileType, String songName, String intro, String mixText, String fileName, int retType) ;
    public static native void systemLoadingCloudFile(int type, int userID, int fileID, int fileType, String mixText, String fileName, int retType) ;
    public static native void systemDeleteCloudFile(int userID, int fileID, int cloudType, int retType);
    public static native void systemReleaseCloudFile(int userID, int fileID, int cloudType, int areaData, String intro, int retType) ;
    public static native String systemWriteKcbCommand(int type, int subType, int length, byte[] in_data, byte[] out_data, int retType);
    public static native String systemWriteNetCommand(int type, String gsLocal_1, String gsLocal_2, String gsLocal_3, int retType);
    public static native void systemNetCommandDone(int type, String gsLocal_1, int length, byte[] in_data);
    public static native void systemGetAuditItem(int next, int retType);
    public static native void systemSetAuditItem(int isPassed, int retType);
    public static native void systemSendSuggestion(String suggestion, String contacts, int retType);
    public static native void systemSetLyricScreen(int line, int columnPixel);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static native void manageFetchAuthCode(int cloudType, int retType) ;
    public static native void manageCheckIsLogined(int cloudType, int retType);
    public static native void manageLoginSvr(int cloudType, String account,  String password, String authCode, int retType);
    public static native void manageLogoutSvr(int cloudType, int retType);
    public static native void manageFetchUserInfo(int cloudType, int userID, int dataTime, int retType);
    public static native void manageModifyUserInfo(int cloudType, String nickName, String mood, String recommend, int birthday, int area, int genderLanguag, int retType);
    public static native void manageModifyPassword(String oldPassword, String newPassword, String authCode, int retType);
    public static native void manageRequestAuthCode(int action, int symbol, int rcvWay, String symbolValue, String imgAuthCode, int retType);
    public static native void manageVerifyAuthCode(String authCode, int retType);
    public static native void manageModifyMailPhone(String mailOrPhone, String authCode, int retType);
    public static native void manageResetPassword(String newPassword, String authCode, int retType);
    public static native void manageAssignUewUserID(int retType);
    public static native void manageRegisterNewUser(int cloudType, String password, int gender, String authCode, int retType);
    public static native void manageThirdPartyLogin(int type, String userID, String token, int retType);
    public static native void manageThirdPartyNewUser(int type, int gender, String userID, String token, String mixText, String imgAuthCode, int retType);
    public static native void manageSearchFriend(String nameInfo, int areaData, int specGender, int retType);
    public static native void managePayMoney(int userID, int money, int retType);
    public static native void manageAutoAddMoney(int userID, int money, int retType);
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static native void domainSetAnaDomainDbs(int type, String name, String password, int retType);
    public static native void domainModifyDomainUser(String name, String password, int stepAnalyze, String urlRedirect, String urlRecord, int retType);
    public static native void domainCheckAvailableName(String name, int retType);
    public static native void domainAddNewDomainUser(String name, String password, int stepAnalyze, String mixText, String authCode, int retType);
    public static native void domainFetchPreUserNeedPrice(String name, int stepAnalyze, int month, int retType);
    public static native void domainRenewalDomainUser(String name, int stepAnalyze, int month, int retType);
    public static native int domainIsDnsSupportRedirect(String name);
    public static native void domainDirectSvrStartup(int type, int port, String name, String password, int retType) ;
    public static native void domainDirectSvrRtcText(int remoteIndex, int code, String text, int retType) ;
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static native int deviceSetDevInfoDbs(int type, int counter, String macAddress, int retType) ;
    public static native void deviceFindDevInfo(int type, int remPort, String domainName, String password, int retType);
    public static native void deviceCancelRestart(int devNum, int local, int remote);
    public static native void deviceFetchWifiList(int devNum, int retType);
    public static native void deviceModifyWifi(int devNum, String wifiName, String password, int retType);
    public static native void deviceDebugControl(int devNum, int debugUser, int layout, int mode, String path, int retType);
    public static native void deviceReadBulkFile(int devNum, int type, int address, int length, String fileName, int retType);
    public static native void deviceWriteBulkFile(int devNum, int type, int address, int length, String fileName, int retType);
    public static native void deviceWriteRtcText(int devNum, int code, String text, int retType);
    public static native void deviceCtrlRemoteKey(int devNum, int key, int retType);
    public static native void devicePlayTrack(int devNum, int userID, int songID, int retType);
    public static native void deviceModifyDevInfo(int devNum, int flag0, int flag1, String mix, int retType);
    public static native void deviceFetchBindInfo(int devNum, int retType);
    public static native void deviceModifyBindInfo(int devNum, int amount, String mix, int retType);
    public static native void deviceFetchShareAdmin(int devNum, int retType);
    public static native void deviceModifyShareAdmin(int devNum, int amount, String mix, int retType);
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static native void rankbaFetchUserDetail(int type, int userID, int retType) ;
    public static native void rankbaFetchSongDetail(int type, int userID, int songID, int retType);
    public static native void rankbaFetchObbligDetail(int type, int musicID0, int musicID1, int retType);
    public static native void rankbaFetchSongFile(int type, int userID, int songID, int retType);


}
